[ef-28] fix: dashboard blank page on npm install (missing static assets)#25
Conversation
Next.js standalone mode does not automatically include .next/static/ (JS/CSS chunks) in the standalone output. Without it every /_next/static/* request 404s and the dashboard renders as a blank page. - Extend `build` to cpSync .next/static → .next/standalone/.next/static after the Next.js build so the published package is self-contained. - Replace `prepublishOnly` with `prepare` so the build also runs during `npm pack` and local `npm install`, fixing local installs that previously shipped without any build output. Verified in Docker (node:20 + bun, --network host): dashboard starts, HTML contains script tags and /_next/static references. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdated Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem
npm install -g failproofai@0.0.1-beta.3installs and the server starts, but the dashboard renders as a completely blank page. All/_next/static/*requests return 404.Root cause
Next.js standalone mode (
output: "standalone") does not automatically copy.next/static/(JS/CSS chunks, fonts, etc.) into the standalone output. The standaloneserver.jsexpects static assets at<server.js dir>/.next/static/=.next/standalone/.next/static/, but that directory was never populated.This was confirmed via Docker (
node:20 --network host): the server started fine butcurlreturned bare HTML with no script tags.Fix
package.json— 2 changes:buildscript — afternext build, copy static assets into the standalone dir:preparereplacesprepublishOnly—prepublishOnlyonly fires duringnpm publish. Usingpreparealso coversnpm packand localnpm install, so testing with a local tarball ornpm install -g .now works correctly without manually runningbun run buildfirst.Verification
Docker test (
node:20 + bun,--network host):ls .next/standalone/.next/static/→ chunks, CSS, manifests present ✓curl -sL localhost:8020 | grep '<script'→ 2 matches ✓/_next/staticreferences present in HTML ✓🤖 Generated with Claude Code